package com.fx.service.impl;

import cn.hutool.core.date.DateUtil;
import com.fx.entity.ShopInfo;
import com.fx.mapper.ShopInfoMapper;
import com.fx.service.ShopInfoService;
import com.fx.util.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class ShopInfoServiceImpl implements ShopInfoService {
    @Autowired
    private ShopInfoMapper shopInfoMapper;
    @Autowired
    private IdWorker idWorker;

    @Override
    public ShopInfo getById(String flId) {
        return shopInfoMapper.getById(flId);
    }

    @Override
    public List<ShopInfo> getList(Map<String, Object> map) {
        return shopInfoMapper.queryList(map);
    }

    @Override
    public int getCount(Map<String, Object> map) {
        return shopInfoMapper.queryCount(map);
    }

    @Override
    public int save(ShopInfo shopInfo) {
        shopInfo.setFlId(String.valueOf(idWorker.nextId()));
        shopInfo.setFlCreatedTime(DateUtil.now());
        return shopInfoMapper.save(shopInfo);
    }

    @Override
    public int updateById(ShopInfo shopInfo) {
        return shopInfoMapper.updateById(shopInfo);
    }

    @Override
    public int remove(String flId) {
        return shopInfoMapper.remove(flId);
    }

    @Override
    public int batchRemove(String[] flIds) {
        return shopInfoMapper.batchRemove(flIds);
    }

}
